package cate.game.play.vo;

import cate.game.play.part.BattleHallow;
import cate.game.play.part.BattleHero;
import cate.game.play.part.BattlePet;
import cate.game.play.part.PlaySide;
import com.fasterxml.jackson.annotation.JsonIgnore;
import easy.java.dev.note.NoteField;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class PlaySideVO {

	@NoteField("玩家快照")
	public RoleSnapShotVO snapshot;

	@NoteField("阵型模板ID")
	public int positionTid;

	@NoteField("上阵的英雄们")
	public List<BattleHero> hs = new ArrayList<>();

	@NoteField("上阵的圣器")
	public BattleHallow hallow;

	@NoteField("上阵的副圣器")
	public BattleHallow deputyHallow;

	@NoteField("上阵的灵宠")
	public Map<Integer, BattlePet> pets;

	public PlaySideVO() {
	}

	public PlaySideVO read(PlaySide playSide) {
		this.snapshot = new RoleSnapShotVO().read(playSide.snapshot);
		this.positionTid = playSide.positionTid;
		this.hs = playSide.hs;
		this.hallow = playSide.hallow;
		this.deputyHallow = playSide.deputyHallow;
		this.pets = playSide.pets;
		return this;
	}

	@JsonIgnore
	public long getTotalPower() {
		long power = 0L;
		for (BattleHero h : hs) {
			power += h.power;
		}
		return power;
	}
}
